package com.block.api.util;

import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.crypto.symmetric.AES;

public class AESUtil {

    private static String aeskey = "1111222211112222";
    private static String iv = "1111222211112222";

    public static String decryptStr(String conent){
        AES aes = new AES("CBC", "PKCS7Padding",
                // 密钥，可以自定义
                aeskey.getBytes(),
                // iv加盐，按照实际需求添加
                iv.getBytes());
        String decryptStr = aes.decryptStr(conent);
        return decryptStr;
    }

    private static String iv_ss = "1111222211112222";

    public static String decryptByKey(String conent, String aesKey){
        AES aes = new AES("CBC", "PKCS7Padding",
                // 密钥，可以自定义
                aesKey.getBytes(),
                // iv加盐，按照实际需求添加
                iv_ss.getBytes());
        String decryptStr = aes.decryptStr(conent);
        return decryptStr;
    }

}
